<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="author" content="lijinbo" />
    <title>074-事件流机制</title>
    <style>
      div {
        color: #fff;
        text-align: center;
      }

      #one {
        width: 300px;
        height: 300px;
        background-color: #999;
      }

      #two {
        width: 200px;
        height: 200px;
        background-color: #333;
      }

      #three {
        width: 100px;
        height: 100px;
        background-color: red;
      }
    </style>
  </head>

  <body>
    <p>
      参考 ：
      <a href="https://www.jianshu.com/p/c4ccec5d9c5e">浏览器事件机制</a>
    </p>
    <div id="one">
      <div id="two">
        <div id="three">three</div>
        two
      </div>
      one
    </div>
    <p>
      <a href="./阻止默认事件和事件冒泡.md" target="_blank"> 阻止默认事件和事件冒泡 </a>
    </p>
    <p>
      <a href="https://zhuanlan.zhihu.com/p/100831300" target="_blank"> 浅谈事件冒泡和事件捕获 </a>
    </p>
    <script>
      var one = document.getElementById('one')
      var two = document.getElementById('two')
      var three = document.getElementById('three')
      one.onclick = function () {
        console.log('-->>> one')
      }
      two.onclick = function (e) {
        console.log('-->>> two')
        // e.stopPropagation();
      }
      three.onclick = function (e) {
        console.log('-->>> three')
        // 阻止当前事件的冒泡
        e.stopPropagation()
      }
    </script>
  </body>
</html>
